import service from "@/api/index.js";
import qs from 'qs';

const userApi = {
    captcha(){
        return service.get("/user/captcha");
    },
    //修改密码
    updatePassword(updatePassWord) {
        return service.put("/user/updatePassword", qs.stringify(updatePassWord))
    },
    updatePayPassword1(updatePayPassWord) {
        return service.put("/user/updatePayPassword1", qs.stringify(updatePayPassWord))
    },
    updatePayPassword2(updatePayPassWord) {
        return service.put("/user/updatePayPassword2", qs.stringify(updatePayPassWord))
    },
    selectAll(condition,pageNum,pageSize){
        if(pageNum){
            condition.pageNum = pageNum;
        }
        if(pageSize){
            condition.pageSize = pageSize;
        }
        return service.get("/user/selectAll",{
            params:condition
        })
    },
    reg(userInfo){
        return service.post("/user/reg",qs.stringify(userInfo));
    },
    login(userInfo){
        return service.post("/user/login", qs.stringify(userInfo));
    },
    getInfo(){
        return service.get("/user/info");
    },
    reset(id) {
        return service.put(`/user/reset/${id}`)
    },
    insert(user) {
        return service.post('/user/insert',user)
    },
    updateStatus(user) {
        return service.put('/user/updateStatus',user)
    },
    selectById(id) {
        return service.get(`/user/${id}`)
    },
    updateInfo(user) {
        return service.put('/user/updateInfo', user)
    },
    recharge(money) {
        return service.put(`/user/recharge/${money}`)
    }
};
export default userApi;